#!/bin/bash

# 1- env path
HIVE_HOME=/usr/bin/hive

# 2- Tran
if [ $# == 1 ]
then
   dateStr=$1

else
   dateStr=`date -d '-1 day' +'%Y-%m-%d'`

fi

echo ${dateStr}




${HIVE_HOME} -S -e "


-- 班级在读学生人数
insert overwrite table dwd_class_studying_student_count  partition(dt)
select 
    *
from ods_class_studying_student_count where create_time = ${dateStr};

-- 班级课表
insert overwrite table dwd_course_table_upload_detail
select 
*
from ods_course_table_upload_detail where create_time = ${dateStr};



-- 学生打卡记录表
insert overwrite table ods_student_signin_record partition(dt)
select
*
from ods_student_signin_record where create_time = ${dateStr};

"
